Phase-I Pixel detector: Efficiency measurements using the first collisions

The purpose of this notebook and presentation is to provide documentation and validation of the efficiency measurements.

- - -
2017. 05. 17.

Tools used

The PhaseIPixelNtuplizer package (used to process the CMSSW output) is available at:

https://github.com/jkarancs/PhaseIPixelNtuplizer

The PhaseIEfficiencyPlotter package (used to create plots) is available at:

https://github.com/hunyadix/PhaseIEfficiencyPlotter


In [1]:
import ROOT, sys
ROOT.gStyle.SetPalette(1)
sys.path.append('../python/')
inputFile = ROOT.TFile.Open("/data/hunyadi/CMSSW/PhaseIEfficiencyPlotter_2017_04_02/CMSSW_9_1_0_pre3/src/DPGAnalysis/PhaseIEfficiencyPlotter/histograms_delayscan_with_bad_ROC_exclusion.root", "READ")

In [2]:
DELAY_PLOTS_NUM_BINS   = 8
DELAY_PLOTS_LOWER_EDGE = 162
DELAY_PLOTS_UPPER_EDGE = 163.6
labelsWBC = [
    "WBC162:++0ns",
    "WBC163:++20ns",
    "WBC163:++15ns",
    "WBC163:++10ns",
    "WBC163:++5ns",
    "WBC163:++0ns",
    "WBC164:++20ns",
    "WBC164:++15ns",
    "WBC164:++10ns",
    "WBC164:++5ns"
]
Y_AXIS_DIVISIONS = 1005
EFFICIENCY_LOWER_EDGE = 0.0
EFFICIENCY_UPPER_EDGE = 1.2

In [3]:
parametrizedSigmoid = ROOT.TF1("parametrizedSigmoid", "[0] / (1 + exp([1] - x) / [2])", 162, 164)

Validation - List of delay scenarios

The Ntuple should contain plots listed in different directories. Each of these directories should correspont to a delay scenario. This code prints out the delay scenarios:


In [4]:
for key in ROOT.gDirectory.GetListOfKeys():
    print key.GetTitle()


Delay_-9999.00
Delay_4044.00
Delay_4069.00
Delay_4094.00
Delay_4032.00
Delay_4057.00
Delay_4082.00
Delay_4107.00
Delay_4100.00
Delay_4050.00
Delay_4088.00
Delay_4063.00
Delay_4075.00
Delay_4047.00
Delay_4054.00
Delay_4060.00
Delay_4066.00
Delay_4072.00
Delay_4079.00
Delay_4085.00
Delay_4097.00
Cluster_size_X_vs_delay
Cluster_size_Y_vs_delay
Cluster_total_size_vs_delay
Cluster_charge_vs_delay
Efficiency_vs_delay

The delay scenarios should have been printed out ("Delay -9999.00" is saved for unknown delay scenarios or simulations).


In [5]:
mainDir = ROOT.gDirectory.Get("Efficiency_vs_delay/Graphs")
for index, directory in enumerate(mainDir.GetListOfKeys()): 
    sys.stdout.write("[ %s ] " % directory.GetTitle())


[ BpixFpix ] [ LayersNegativePositive ] [ DisksInnerOuter ] [ LayerDetailed ] 

Validation - Plots

Efficiency vs delay on the barrel and forward regions


In [6]:
def getGraph(efficiencyHistogram, markerColor, markerStyle):
    xAxis = efficiencyHistogram.GetXaxis()
    yAxis = efficiencyHistogram.GetYaxis()
    numBins = xAxis.GetNbins()
    valuesX     = ROOT.vector("double")()
    valuesY     = ROOT.vector("double")()
    numZeroBins = 0
    for bin in range(numBins):
       if(efficiencyHistogram.GetBinContent(bin + 1) == 0):
          numZeroBins = numZeroBins + 1
          continue
       valuesX.push_back(xAxis.GetBinCenter(bin + 1))
       valuesY.push_back(efficiencyHistogram.GetBinContent(bin + 1))
    graph = ROOT.TGraph(numBins - numZeroBins, valuesX.data(), valuesY.data())
    graph.SetTitle(efficiencyHistogram.GetTitle())
    graph.GetXaxis().SetTitle(xAxis.GetTitle())
    graph.GetYaxis().SetTitle(yAxis.GetTitle())
    graph.GetXaxis().SetTitleSize(xAxis.GetTitleSize())
    graph.GetYaxis().SetTitleSize(yAxis.GetTitleSize())
    graph.GetXaxis().SetTitleOffset(xAxis.GetTitleOffset())
    graph.GetYaxis().SetTitleOffset(yAxis.GetTitleOffset())
    graph.GetXaxis().SetTitleFont(xAxis.GetTitleFont())
    graph.GetYaxis().SetTitleFont(yAxis.GetTitleFont())
    graph.GetXaxis().SetRangeUser (xAxis.GetXmin(), xAxis.GetXmax())
    graph.GetXaxis().SetNdivisions(xAxis.GetNdivisions())
    graph.GetYaxis().SetNdivisions(yAxis.GetNdivisions())
    graph.GetXaxis().SetLabelOffset(xAxis.GetLabelOffset())
    graph.GetYaxis().SetLabelOffset(yAxis.GetLabelOffset())
    graph.SetMarkerColor(markerColor)
    graph.SetFillColor(markerColor)
    graph.SetMarkerStyle(markerStyle)
    graph.SetLineWidth(1)
    graph.SetLineStyle(1)
    graph.SetMarkerSize(0.8)
    return graph

In [7]:
def resetCanvasMargins(canvas):
    canvas.SetLeftMargin(0.1)
    canvas.SetRightMargin(0.1)
    canvas.SetBottomMargin(0.1)
    canvas.SetTopMargin(0.1)

def createOverlayingPadPair(firstPadName, secondPadName):
    p1 = ROOT.TPad(firstPadName, "", 0, 0, 1, 1)
    p1.SetGrid()
    p2 = ROOT.TPad(secondPadName, "", 0, 0, 1, 1)
    p2.SetFillStyle(4111)
    p1.SetBottomMargin(0.22)
    p1.Draw()
    return (p1, p2)

def setupXAxis(graph):
    graph.GetXaxis().SetLabelOffset(0.0)
    graph.GetXaxis().SetTitleOffset(3.3)
    graph.GetXaxis().Set(DELAY_PLOTS_NUM_BINS, DELAY_PLOTS_LOWER_EDGE, DELAY_PLOTS_UPPER_EDGE)
    graph.GetXaxis().SetNdivisions(-500 - DELAY_PLOTS_NUM_BINS)
    graph.GetXaxis().CenterTitle()
    for numBin in range(len(labelsWBC)):
        graph.GetXaxis().ChangeLabel(numBin + 1, 60, 0.020, 32, -1, -1, labelsWBC[numBin])
    
def setupMainYAxis(graph, title, lowerEdge, upperEdge):
    graph.GetYaxis().SetTitle(title)
    graph.GetYaxis().SetLabelSize(0.035)
    graph.GetYaxis().SetLabelFont(42)
    graph.GetYaxis().SetRangeUser(lowerEdge, upperEdge)
    graph.GetYaxis().SetNdivisions(-Y_AXIS_DIVISIONS)
    graph.GetYaxis().SetTitleFont(42)
    graph.GetYaxis().CenterTitle()
    graph.GetYaxis().SetTitleOffset(1.2)
    
def getSecondaryYAxis(yMin, yMax):
    secondaryAxis = ROOT.TGaxis(DELAY_PLOTS_UPPER_EDGE, yMin, DELAY_PLOTS_UPPER_EDGE, yMax, 0, 1.2, 50510, "+L")
    secondaryAxis.SetTitle("Hit Efficiency") 
    secondaryAxis.SetLabelOffset(0.012)
    secondaryAxis.SetLabelSize(0.035)
    secondaryAxis.SetTextFont(42)
    secondaryAxis.SetLabelFont(42)
    secondaryAxis.SetLabelColor(ROOT.kBlue)
    secondaryAxis.SetTitleColor(ROOT.kBlue)
    secondaryAxis.SetLineColor(ROOT.kBlue)
    secondaryAxis.CenterTitle()
    return secondaryAxis

def drawSecondGraph(p1, p2, graph):
    xmin = DELAY_PLOTS_LOWER_EDGE;
    xmax = DELAY_PLOTS_UPPER_EDGE;
    dx = (xmax - xmin) / 0.8;
    ymin = 0.0;
    ymax = 1.2;
    dy = (ymax - ymin) / (1.0 - p1.GetBottomMargin() - p1.GetTopMargin());
    p2.Range(xmin - 0.1 * dx, ymin - p1.GetBottomMargin() * dy, xmax + 0.1 * dx, ymax + p1.GetTopMargin() * dy)
    p2.Draw()
    p2.cd()
    graph.Draw("P0")
    ROOT.gPad.Update()
    
def drawWithSigmoidFitFunction(name, graph):
    parametrizedSigmoid = ROOT.TF1("parametrizedSigmoid", "[0] / (1 + exp(([1] - x) / [2]))")
    parametrizedSigmoid.SetParLimits(1, 160, 166)
    parametrizedSigmoid.SetParameter(0, 1.0)
    parametrizedSigmoid.SetParameter(1, 162.0)
    parametrizedSigmoid.SetParameter(2, 0.09)
    canvas = ROOT.TCanvas(name, name)
    canvas.SetGrid()
    canvas.SetBottomMargin(0.2)
    graph.Draw("0AP")
    setupXAxis(graph)
    setupMainYAxis(graph, "Hit Efficiency", 0.0, 1.2)
    graph.Fit("parametrizedSigmoid", "M")
    ROOT.gStyle.SetOptFit(1)
    #ps = graph.GetListOfFunctions().FindObject("stats")
    #ps.SetX1NDC(0.15)
    #ps.SetX2NDC(0.55)
    canvas.Draw()
    return canvas

In [8]:
canvas = ROOT.TCanvas("bpixCanvas")
graph = ROOT.TMultiGraph("FpixBpix", "Efficiency vs delay on BPix;delay(WBC setting + ns)")
clusterHisto = ROOT.gDirectory.Get("Cluster_total_size_vs_delay").Get("delayVsClusterSizePixelsBPix")
clusterHistoAsGraph = getGraph(clusterHisto, 2, 23)
efficiencyAsGraph = mainDir.Get("BpixFpix").Get("delayVsEfficiencyBPixAsGraph") 
# Creating the first graph
graph.Add(clusterHistoAsGraph)
# Set up canvas margins
resetCanvasMargins(canvas)
# Creating two overlaying TPads
p1, p2 = createOverlayingPadPair("autoP1", "autoP2")
p1.cd()
# Drawing the first graph
graph.Draw("0AP")
ROOT.gPad.Update()
# Styling the range-axis
setupXAxis(graph)
# Styling the first value axis
setupMainYAxis(graph, "Avg. cluster size", 3.0, 5.0)
# Creating and styling the second value axis
secondaryAxis = getSecondaryYAxis(3.0, 5.0)
secondaryAxis.Draw()
# Drawing the second graph
drawSecondGraph(p1, p2, efficiencyAsGraph)
#canvas.BuildLegend(0.15, 0.50, 0.40, 0.70, "", "P");

In [9]:
canvas.Draw()
label = ROOT.TLatex()
label.SetTextAlign(22)
label.DrawLatexNDC(0.50 + p1.GetRightMargin() / 2 - p1.GetLeftMargin() / 2, 0.5 + p1.GetBottomMargin() / 2 - p1.GetTopMargin() / 2, "BPix");
canvas.SaveAs("plots/" + canvas.GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/bpixCanvas.eps has been created

In [10]:
graph = ROOT.TMultiGraph("FpixBpix", "Efficiency vs delay on BPix;delay(WBC setting + ns)")
graph.Add(efficiencyAsGraph)
canvas = drawWithSigmoidFitFunction(efficiencyAsGraph.GetName() + "Canvas", graph)
ps = efficiencyAsGraph.GetListOfFunctions().FindObject("stats")
ps.SetX1NDC(0.15)
ps.SetX2NDC(0.55)
label = ROOT.TLatex()
label.SetTextAlign(22)
label.DrawLatexNDC(0.50 + canvas.GetRightMargin() / 2 - canvas.GetLeftMargin() / 2, 0.5 + canvas.GetBottomMargin() / 2 - canvas.GetTopMargin() / 2, "BPix");
canvas.Update()
canvas.SaveAs("plots/" + efficiencyAsGraph.GetName() + "WithFit.eps")


 FCN=8.54763e+08 FROM MIGRAD    STATUS=FAILED        326 CALLS         327 TOTAL
                     EDM=1.63263e+09    STRATEGY= 1      ERR MATRIX APPROXIMATE
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.37719e-01   2.35906e-06   4.49723e-06   3.54391e+10
   2  p1           1.62678e+02   1.65486e-06   5.23483e-07  -1.26682e+11
   3  p2           9.58348e-02   1.80552e-06   2.83112e-06  -4.95586e+10
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on BPixWithFit.eps has been created

In [11]:
canvas = ROOT.TCanvas("fpixCanvas")
graph = ROOT.TMultiGraph("FpixBpix", "Efficiency vs delay on FPix;delay(WBC setting + ns)")
clusterHisto = ROOT.gDirectory.Get("Cluster_total_size_vs_delay").Get("delayVsClusterSizePixelsFPix")
clusterHistoAsGraph = getGraph(clusterHisto, 2, 23)
efficiencyAsGraph = mainDir.Get("BpixFpix").Get("delayVsEfficiencyFPixAsGraph") 
# Creating the first graph
graph.Add(clusterHistoAsGraph)
# Set up canvas margins
resetCanvasMargins(canvas)
# Creating two overlaying TPads
p1, p2 = createOverlayingPadPair("autoP1", "autoP2")
p1.cd()
# Drawing the first graph
graph.Draw("0AP")
ROOT.gPad.Update()
# Styling the range-axis
setupXAxis(graph)
# Styling the first value axis
setupMainYAxis(graph, "Avg. cluster size", 3.0, 5.0)
# Creating and styling the second value axis
secondaryAxis = getSecondaryYAxis(3.0, 5.0)
secondaryAxis.Draw()
# Drawing the second graph
drawSecondGraph(p1, p2, efficiencyAsGraph)

In [12]:
canvas.Draw()
label = ROOT.TLatex()
label.SetTextAlign(22)
label.DrawLatexNDC(0.50 + p1.GetRightMargin() / 2 - p1.GetLeftMargin() / 2, 0.5 + p1.GetBottomMargin() / 2 - p1.GetTopMargin() / 2, "FPix");
canvas.SaveAs("plots/" + canvas.GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/fpixCanvas.eps has been created

In [13]:
graph = ROOT.TMultiGraph("FpixBpix", "Efficiency vs delay on FPix;delay(WBC setting + ns)")
graph.Add(efficiencyAsGraph)
canvas = drawWithSigmoidFitFunction(efficiencyAsGraph.GetName() + "Canvas", graph)
label = ROOT.TLatex()
label.SetTextAlign(22)
label.DrawLatexNDC(0.50 + canvas.GetRightMargin() / 2 - canvas.GetLeftMargin() / 2, 0.5 + canvas.GetBottomMargin() / 2 - canvas.GetTopMargin() / 2, "BPix");
canvas.Update()
canvas.SaveAs("plots/" + efficiencyAsGraph.GetName() + "WithFit.eps")


 FCN=2.34384e+08 FROM MIGRAD    STATUS=FAILED        156 CALLS         157 TOTAL
                     EDM=1.26588e+08    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.99969e-01   1.00000e+00  -0.00000e+00   3.94355e+09
   2  p1           1.62138e+02   4.01069e+00   0.00000e+00  -1.62974e+06
   3  p2           9.00152e-02   1.00000e+00   0.00000e+00  -5.91578e+06
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on FPixWithFit.eps has been created

Efficiency vs delay on the barrel - sides of layers


In [14]:
canvases = [None] * 2
graphs   = [None] * 2
efficiencyGraphNames = [
    [
        "delayVsEfficiencyLayer1NegativeAsGraph",
        "delayVsEfficiencyLayer2NegativeAsGraph",
        "delayVsEfficiencyLayer3NegativeAsGraph",
        "delayVsEfficiencyLayer4NegativeAsGraph"],
    [
        "delayVsEfficiencyLayer1PositiveAsGraph",
        "delayVsEfficiencyLayer2PositiveAsGraph",
        "delayVsEfficiencyLayer3PositiveAsGraph",
        "delayVsEfficiencyLayer4PositiveAsGraph"]]
canvases[0] = ROOT.TCanvas("LayersNegativeCanvas")
canvases[1] = ROOT.TCanvas("LayersPositiveCanvas")
graphs[0] = ROOT.TMultiGraph("LayersNegative", 
    "Efficiency vs delay on layers - negative side;delay(WBC setting + ns);efficiency")
graphs[1] = ROOT.TMultiGraph("LayersPositive", 
    "Efficiency vs delay on layers - positive side;delay(WBC setting + ns);efficiency")
for graphIndex, graphNames in enumerate(efficiencyGraphNames):
    for markerIndex, graphName in enumerate(graphNames):
        graph = ROOT.TGraphAsymmErrors(mainDir.Get("LayersNegativePositive").Get(graphName))
        graph.SetMarkerColor(1 + markerIndex)
        graph.SetMarkerStyle(20 + markerIndex)
        graphs[graphIndex].Add(graph)
for graphIndex in range(len(graphs)):
    canvases[graphIndex].cd()
    canvases[graphIndex].SetGrid()
    canvases[graphIndex].SetBottomMargin(0.2)
    graphs[graphIndex].Draw("0AP")
    setupXAxis(graphs[graphIndex])
    setupMainYAxis(graphs[graphIndex], "Hit Efficiency", EFFICIENCY_LOWER_EDGE, EFFICIENCY_UPPER_EDGE)
    graphs[graphIndex].GetYaxis().SetNdivisions(-1005)
    legend = canvases[graphIndex].BuildLegend(0.12, 0.63, 0.55, 0.88, "", "P")
    #legend.SetBorderSize(0);
    #legend.SetFillColorAlpha(10, 0.1);
[Use the up and down keys to navigate between plots.]

In [15]:
canvases[0].Draw()
canvases[0].SaveAs("plots/" + canvases[0].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/LayersNegativeCanvas.eps has been created

In [16]:
canvases[1].Draw()
canvases[1].SaveAs("plots/" + canvases[1].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/LayersPositiveCanvas.eps has been created

In [17]:
canvases = [None] * 8
graphs   = [None] * 8
mGraphs  = [None] * 8
for index in range(len(canvases)):
    originalCanvasIndex = index / 4
    originalGraphName   = efficiencyGraphNames[originalCanvasIndex][index % 4]
    graphs[index]  = ROOT.TGraphAsymmErrors(mainDir.Get("LayersNegativePositive").Get(originalGraphName))
    mGraphs[index] = ROOT.TMultiGraph(originalGraphName + "WithFit", graphs[index].GetTitle() + ";delay(WBC setting + ns)")
    mGraphs[index].Add(graphs[index])
    canvases[index] = drawWithSigmoidFitFunction(graphs[index].GetName() + "Canvas", mGraphs[index])
    print canvases[index]
    canvases[index].Draw()
    ps = graphs[index].GetListOfFunctions().FindObject("stats")
    ps.SetX1NDC(0.15)
    ps.SetX2NDC(0.55)
    label = ROOT.TLatex()
    label.SetTextAlign(22)
    label.DrawLatexNDC(0.50 + canvases[index].GetRightMargin() / 2 - canvases[index].GetLeftMargin() / 2, 0.5 + canvases[index].GetBottomMargin() / 2 - canvases[index].GetTopMargin() / 2, graphs[index].GetTitle()[23:].capitalize());
    canvases[index].Update()
    canvases[index].SaveAs("plots/" + graphs[index].GetName() + "WithFit.eps")


 FCN=8.92837e+06 FROM HESSE     STATUS=NOT POSDEF     26 CALLS         436 TOTAL
                     EDM=5.61394e-29    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.02353e+00   9.57515e-23   5.63586e-07   6.38590e+07
   2  p1           1.63134e+02   0.00000e+00   2.05849e-04  -4.33595e+08
   3  p2           9.18047e-02   2.27378e-23   1.90600e-07  -1.97612e+08
<ROOT.TCanvas object ("delayVsEfficiencyLayer1NegativeAsGraphCanvas") at 0x5e1ec20>
 FCN=24.0211 FROM MIGRAD    STATUS=FAILED        280 CALLS         281 TOTAL
                     EDM=2.2681e+35    STRATEGY= 1  ERROR MATRIX UNCERTAINTY 100.0 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.91949e-01   1.69251e-05   0.00000e+00  -8.06970e+21
   2  p1           1.62323e+02   1.26068e-04  -0.00000e+00   3.43924e+21
   3  p2           6.62323e-02   1.03496e-04  -0.00000e+00   2.82700e+20
<ROOT.TCanvas object ("delayVsEfficiencyLayer2NegativeAsGraphCanvas") at 0x5e64640>
 FCN=7.71453e+06 FROM MIGRAD    STATUS=FAILED        110 CALLS         111 TOTAL
                     EDM=1.45178e+24    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   5.66260e-21   0.00000e+00  -4.25564e+32
   2  p1           1.62009e+02   0.00000e+00   0.00000e+00  -3.91739e+04
   3  p2           9.00000e-02   6.35267e-18  -0.00000e+00  -1.32009e+05
<ROOT.TCanvas object ("delayVsEfficiencyLayer3NegativeAsGraphCanvas") at 0x5e5e260>
 FCN=1.87043e+07 FROM MIGRAD    STATUS=FAILED        145 CALLS         146 TOTAL
                     EDM=1.64963e+14    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   4.19851e-15   0.00000e+00  -4.44842e+21
   2  p1           1.62178e+02   4.40536e-13  -0.00000e+00   2.02682e+20
   3  p2           9.00245e-02   1.42613e-13   0.00000e+00   2.40211e+19
<ROOT.TCanvas object ("delayVsEfficiencyLayer4NegativeAsGraphCanvas") at 0x5e6cea0>
 FCN=81902.4 FROM HESSE     STATUS=NOT POSDEF     30 CALLS         689 TOTAL
                     EDM=0.00328067    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.23347e-01   1.12075e-08   5.99928e-07   2.96143e+06
   2  p1           1.63165e+02   0.00000e+00   2.77634e-04  -1.25146e+06
   3  p2           6.72565e-01   9.49931e-08   3.27118e-06   5.04143e+05
<ROOT.TCanvas object ("delayVsEfficiencyLayer1PositiveAsGraphCanvas") at 0x5e7f930>
 FCN=97386.8 FROM MIGRAD    STATUS=FAILED        155 CALLS         156 TOTAL
                     EDM=1.06451e+27    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   1.59003e-21   0.00000e+00  -4.11864e+34
   2  p1           1.62183e+02   0.00000e+00  -0.00000e+00   3.79735e+31
   3  p2           9.00000e-02   2.29912e-19   0.00000e+00   5.03008e+31
<ROOT.TCanvas object ("delayVsEfficiencyLayer2PositiveAsGraphCanvas") at 0x5e955a0>
 FCN=1.27356e+07 FROM HESSE     STATUS=NOT POSDEF     26 CALLS         233 TOTAL
                     EDM=3.2693e-07    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.99953e-01   5.49050e-13   2.38407e-07   3.58200e+08
   2  p1           1.62834e+02   1.75930e-11   1.09703e-06  -1.04433e+08
   3  p2           9.03217e-02   3.66783e-28   4.57049e-04  -1.66628e+08
<ROOT.TCanvas object ("delayVsEfficiencyLayer3PositiveAsGraphCanvas") at 0x5ebd330>
 FCN=10146 FROM HESSE     STATUS=NOT POSDEF     30 CALLS        1079 TOTAL
                     EDM=1.56443e-08    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           6.52118e-01   9.35448e-05   2.03243e-06  -9.62974e-01
   2  p1           1.60020e+02   5.48620e+00   5.00000e-01   7.28005e-07
   3  p2           1.05218e-01   5.86672e+00   4.42917e-02   5.58105e-05
<ROOT.TCanvas object ("delayVsEfficiencyLayer4PositiveAsGraphCanvas") at 0x5ec29e0>
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer1NegativeAsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer2NegativeAsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer3NegativeAsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer4NegativeAsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer1PositiveAsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer2PositiveAsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer3PositiveAsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyLayer4PositiveAsGraphWithFit.eps has been created

Efficiency vs delay on the disks - inner and outer rings on both endcaps


In [18]:
canvases = [None] * 4
graphs   = [None] * 4
efficiencyGraphNames = [
    [
        "delayVsEfficiencyDisk1NegativeSideInnerRingAsGraph",
        "delayVsEfficiencyDisk2NegativeSideInnerRingAsGraph",
        "delayVsEfficiencyDisk3NegativeSideInnerRingAsGraph"],
    [
        "delayVsEfficiencyDisk1NegativeSideOuterRingAsGraph",
        "delayVsEfficiencyDisk2NegativeSideOuterRingAsGraph",
        "delayVsEfficiencyDisk3NegativeSideOuterRingAsGraph"],
    [
        "delayVsEfficiencyDisk1PositiveSideInnerRingAsGraph",
        "delayVsEfficiencyDisk2PositiveSideInnerRingAsGraph",
        "delayVsEfficiencyDisk3PositiveSideInnerRingAsGraph"],
    [
        "delayVsEfficiencyDisk1PositiveSideOuterRingAsGraph",
        "delayVsEfficiencyDisk2PositiveSideOuterRingAsGraph",
        "delayVsEfficiencyDisk3PositiveSideOuterRingAsGraph"]]
canvases[0] = ROOT.TCanvas("InnerRingsNegativeCanvas")
canvases[1] = ROOT.TCanvas("OuterRingsNegativeCanvas")
canvases[2] = ROOT.TCanvas("InnerRingsPositiveCanvas")
canvases[3] = ROOT.TCanvas("OuterRingsPositiveCanvas")
graphs[0] = ROOT.TMultiGraph("InnerRingsNegative", 
    "Efficiency vs delay on inner rings - negative side;delay(WBC setting + ns);efficiency")
graphs[1] = ROOT.TMultiGraph("OuterRingsNegative", 
    "Efficiency vs delay on outer rings - negative side;delay(WBC setting + ns);efficiency")
graphs[2] = ROOT.TMultiGraph("InnerRingsPositive", 
    "Efficiency vs delay on inner rings - positive side;delay(WBC setting + ns);efficiency")
graphs[3] = ROOT.TMultiGraph("OuterRingsPositive", 
    "Efficiency vs delay on outer rings - positive side;delay(WBC setting + ns);efficiency")
for graphIndex, graphNames in enumerate(efficiencyGraphNames):
    for markerIndex, graphName in enumerate(graphNames):
        graph = ROOT.TGraphAsymmErrors(mainDir.Get("DisksInnerOuter").Get(graphName))
        graph.SetMarkerColor(1 + markerIndex)
        graph.SetMarkerStyle(20 + markerIndex)
        graphs[graphIndex].Add(graph)
for graphIndex in range(len(graphs)):
    canvases[graphIndex].cd()
    canvases[graphIndex].SetGrid()
    canvases[graphIndex].SetBottomMargin(0.2)
    graphs[graphIndex].Draw("0AP")
    setupXAxis(graphs[graphIndex])
    setupMainYAxis(graphs[graphIndex], "Hit Efficiency", 0.0, 1.2)
    canvases[graphIndex].BuildLegend(0.14, 0.38, 0.57, 0.58, "", "P")
[Use the up and down keys to navigate between plots.]

In [19]:
canvases[0].Draw()
canvases[0].SaveAs("plots/" + canvases[0].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/InnerRingsNegativeCanvas.eps has been created

In [20]:
canvases[1].Draw()
canvases[1].SaveAs("plots/" + canvases[1].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/OuterRingsNegativeCanvas.eps has been created

In [21]:
canvases[2].Draw()
canvases[2].SaveAs("plots/" + canvases[2].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/InnerRingsPositiveCanvas.eps has been created

In [22]:
canvases[3].Draw()
canvases[3].SaveAs("plots/" + canvases[3].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/OuterRingsPositiveCanvas.eps has been created

In [23]:
canvases = [None] * 12
graphs   = [None] * 12
mGraphs  = [None] * 12
for index in range(12):
    originalGraphName   = efficiencyGraphNames[index / 4][index % 3]
    graphs[index]  = ROOT.TGraphAsymmErrors(mainDir.Get("DisksInnerOuter").Get(originalGraphName))
    mGraphs[index] = ROOT.TMultiGraph(originalGraphName + "WithFit", graphs[index].GetTitle() + ";delay(WBC setting + ns)")
    mGraphs[index].Add(graphs[index])
    canvases[index] = drawWithSigmoidFitFunction(graphs[index].GetName() + "Canvas", mGraphs[index])
    print canvases[index]
    canvases[index].Draw()
    ps = graphs[index].GetListOfFunctions().FindObject("stats")
    if ps:
        ps.SetX1NDC(0.15)
        ps.SetX2NDC(0.55)
    label = ROOT.TLatex()
    label.SetTextAlign(22)
    label.DrawLatexNDC(0.50 + canvases[index].GetRightMargin() / 2 - canvases[index].GetLeftMargin() / 2, 0.5 + canvases[index].GetBottomMargin() / 2 - canvases[index].GetTopMargin() / 2, graphs[index].GetTitle()[23:].capitalize());
    canvases[index].Update()
    canvases[index].SaveAs("plots/" + graphs[index].GetName() + "WithFit.eps")


 FCN=15.2229 FROM MIGRAD    STATUS=CALL LIMIT   1345 CALLS        1346 TOTAL
                     EDM=0.00227932    STRATEGY= 1  ERROR MATRIX UNCERTAINTY  46.8 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.23844e+00   1.91521e-02  -2.17473e-05   7.20750e-01
   2  p1           1.65616e+02   5.30011e+00   1.77352e-03  -4.61885e-03
   3  p2           9.75631e+01   1.47461e+01  -1.48484e-02  -2.95258e-03
<ROOT.TCanvas object ("delayVsEfficiencyDisk1NegativeSideInnerRingAsGraphCanvas") at 0x5e3c3a0>
 FCN=545300 FROM MIGRAD    STATUS=FAILED        108 CALLS         109 TOTAL
                     EDM=2.9669e+63    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00137e+00   1.00000e+00  -0.00000e+00   2.48121e+07
   2  p1           1.61976e+02   3.95095e+00  -0.00000e+00   4.29880e+32
   3  p2           8.55508e-02   1.00000e+00  -0.00000e+00   9.26770e+31
<ROOT.TCanvas object ("delayVsEfficiencyDisk2NegativeSideInnerRingAsGraphCanvas") at 0x5e62a80>
 FCN=901517 FROM MIGRAD    STATUS=FAILED        135 CALLS         136 TOTAL
                     EDM=2.73612e+87    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00113e+00   2.73549e+25  -1.33716e-05   7.20660e+07
   2  p1           1.60677e+02   3.00000e+00   5.47047e+27  -2.65980e+20
   3  p2           1.23867e-03   2.58609e+33  -0.00000e+00   0.00000e+00
<ROOT.TCanvas object ("delayVsEfficiencyDisk3NegativeSideInnerRingAsGraphCanvas") at 0x5ed4020>
 FCN=15.2229 FROM MIGRAD    STATUS=CALL LIMIT   1345 CALLS        1346 TOTAL
                     EDM=0.00227932    STRATEGY= 1  ERROR MATRIX UNCERTAINTY  46.8 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.23844e+00   1.91521e-02  -2.17473e-05   7.20750e-01
   2  p1           1.65616e+02   5.30011e+00   1.77352e-03  -4.61885e-03
   3  p2           9.75631e+01   1.47461e+01  -1.48484e-02  -2.95258e-03
<ROOT.TCanvas object ("delayVsEfficiencyDisk1NegativeSideInnerRingAsGraphCanvas") at 0x5ed83a0>
 FCN=7.76423e+06 FROM MIGRAD    STATUS=FAILED        133 CALLS         134 TOTAL
                     EDM=1.74332e+25    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   3.89740e-21   0.00000e+00  -2.14261e+33
   2  p1           1.62115e+02   0.00000e+00   0.00000e+00  -4.76377e+04
   3  p2           9.00000e-02   2.39065e-18  -0.00000e+00  -1.73955e+05
<ROOT.TCanvas object ("delayVsEfficiencyDisk2NegativeSideOuterRingAsGraphCanvas") at 0x5ed7c60>
 FCN=41.2343 FROM HESSE     STATUS=NOT POSDEF     34 CALLS         268 TOTAL
                     EDM=1.01242e-05    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00922e+00   1.32792e+00   1.15018e-02   2.73921e-02
   2  p1           1.63423e+02   1.35488e-02   5.60420e-04  -5.60541e-01
   3  p2           9.01158e-02   4.18452e-01   3.57663e-03   7.68978e-02
<ROOT.TCanvas object ("delayVsEfficiencyDisk3NegativeSideOuterRingAsGraphCanvas") at 0x5ec3980>
 FCN=2.71129e+06 FROM MIGRAD    STATUS=FAILED        120 CALLS         121 TOTAL
                     EDM=4.22075e+87    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00044e+00   1.00002e+00  -0.00000e+00   2.89379e+07
   2  p1           1.61980e+02   3.96305e+00  -0.00000e+00   0.00000e+00
   3  p2           6.71323e-04   1.00000e+00   0.00000e+00  -1.50224e+41
<ROOT.TCanvas object ("delayVsEfficiencyDisk1NegativeSideOuterRingAsGraphCanvas") at 0x5edaa00>
 FCN=7.76423e+06 FROM MIGRAD    STATUS=FAILED        133 CALLS         134 TOTAL
                     EDM=1.74332e+25    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   3.89740e-21   0.00000e+00  -2.14261e+33
   2  p1           1.62115e+02   0.00000e+00   0.00000e+00  -4.76377e+04
   3  p2           9.00000e-02   2.39065e-18  -0.00000e+00  -1.73955e+05
<ROOT.TCanvas object ("delayVsEfficiencyDisk2NegativeSideOuterRingAsGraphCanvas") at 0x5e92ee0>
<ROOT.TCanvas object ("delayVsEfficiencyDisk3PositiveSideInnerRingAsGraphCanvas") at 0x5ee63f0>
 FCN=1516.89 FROM HESSE     STATUS=OK             34 CALLS         309 TOTAL
                     EDM=2.65726e+38    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           8.84529e-01   2.58611e-04   2.10888e-07   3.96355e-01
   2  p1           1.61667e+02   3.10124e+00   5.00000e-02   2.61878e-07
   3  p2           1.95557e-02   1.03613e-21   2.38861e-02  -2.22494e+40
<ROOT.TCanvas object ("delayVsEfficiencyDisk1PositiveSideInnerRingAsGraphCanvas") at 0x5ee7260>
 FCN=8.42786e-07 FROM HESSE     STATUS=OK             16 CALLS         807 TOTAL
                     EDM=1.20789e-06    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00004e+00   1.38720e-01   7.69922e-06  -1.48894e-02
   2  p1           1.62866e+02   4.56315e+00   2.52286e-04  -1.22153e-05
   3  p2          -6.46419e-02   6.59778e+00   8.91508e-05  -3.05287e-04
<ROOT.TCanvas object ("delayVsEfficiencyDisk2PositiveSideInnerRingAsGraphCanvas") at 0x5eebb70>
<ROOT.TCanvas object ("delayVsEfficiencyDisk3PositiveSideInnerRingAsGraphCanvas") at 0x5ef3910>
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 1, Negative Z, Inner RingWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 2, Negative Z, Inner RingWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 3, Negative Z, Inner RingWithFit.eps has been created
Warning in <TCanvas::Constructor>: Deleting canvas with same name: delayVsEfficiencyDisk1NegativeSideInnerRingAsGraphCanvas
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 1, Negative Z, Inner RingWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 2, Negative Z, Outer RingWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 3, Negative Z, Outer RingWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 1, Negative Z, Outer RingWithFit.eps has been created
Warning in <TCanvas::Constructor>: Deleting canvas with same name: delayVsEfficiencyDisk2NegativeSideOuterRingAsGraphCanvas
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 2, Negative Z, Outer RingWithFit.eps has been created
Warning in <Fit>: Fit data is empty 
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 3, Positive Z, Inner RingWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 1, Positive Z, Inner RingWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 2, Positive Z, Inner RingWithFit.eps has been created
Warning in <TCanvas::Constructor>: Deleting canvas with same name: delayVsEfficiencyDisk3PositiveSideInnerRingAsGraphCanvas
Warning in <Fit>: Fit data is empty 
Info in <TCanvas::Print>: eps file plots/Delay vs efficiency on disk 3, Positive Z, Inner RingWithFit.eps has been created

Efficiency vs delay on the barrel - sectors of half shells on both sides


In [24]:
canvases              = [None] * 8
graphs                = [None] * 8
sideStrings           = ["Negative", "Positive"]
layerPairStrings      = ["1 and 2", "3 and 4"]
layerPairStringsShort = ["1and2", "3and4"]
markerStyles          = [20, 21, 22, 23, 29, 33, 34, 3]
for index in range(64):
    side                   = index / 32
    halfShell              = (index - side * 32) / 16
    layerPair              = (index - side * 32 - halfShell * 16) / 8
    sec                    = index % 8
    sideAsString           = sideStrings[side - 1]
    secAsString            = str(sec + 1)
    halfShellAsString      = sideStrings[halfShell - 1]
    layerPairAsString      = layerPairStrings[layerPair - 1]
    layerPairAsShortString = layerPairStringsShort[layerPair - 1]
    graphIndex             = side * 4 + halfShell * 2 + layerPair
    if sec == 0: 
        canvases[graphIndex] = ROOT.TCanvas(sideAsString.lower() + "Z" + halfShellAsString + "XShellLayers" + layerPairAsShortString + "canvas")
        graphs[graphIndex]   = ROOT.TMultiGraph(sideAsString.lower() + "Z" + halfShellAsString + "Layers" + layerPairAsShortString, 
            "Efficiency vs delay on sectors - " + sideAsString.lower() + " Z, " + halfShellAsString.lower() + " X shell, layers " + layerPairAsString + ";delay(WBC setting + ns);efficiency")
    graph = ROOT.TGraphAsymmErrors(mainDir.Get("LayerDetailed").Get("delayVsEfficiency" + sideAsString + "Z" + halfShellAsString + "XShellSector" + secAsString + "Layers" + layerPairAsShortString + "AsGraph"))
    graph.SetTitle(graph.GetTitle()[35:-5])
    graph.SetMarkerColor(1 + index % 8)
    graph.SetMarkerStyle(markerStyles[index % 8])
    graphs[graphIndex].Add(graph)
for graphIndex in range(len(graphs)):
    graphs[graphIndex].SetTitle("Efficiency vs delay on sectors")
    canvases[graphIndex].cd()
    canvases[graphIndex].SetGrid()
    canvases[graphIndex].SetBottomMargin(0.2)
    graphs[graphIndex].Draw("0AP")
    setupXAxis(graphs[graphIndex])
    setupMainYAxis(graphs[graphIndex], "Hit Efficiency", 0.0, 1.2)
    for numBin in range(len(labelsWBC)):
        graphs[graphIndex].GetXaxis().ChangeLabel(numBin + 1, 60, 0.020, 32, -1, -1, labelsWBC[numBin])
    legend = canvases[graphIndex].BuildLegend(0.22, 0.68, 0.88, 0.88, "", "P")
    legend.SetNColumns(2)
[Use the up and down keys to navigate between plots.]

In [25]:
canvases[0].Draw()
canvases[0].SaveAs("plots/" + canvases[0].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/positiveZPositiveXShellLayers3and4canvas.eps has been created

In [27]:
canvases[1].Draw()
canvases[1].SaveAs("plots/" + canvases[1].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/positiveZPositiveXShellLayers1and2canvas.eps has been created

In [28]:
canvases[2].Draw()
canvases[2].SaveAs("plots/" + canvases[2].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/positiveZNegativeXShellLayers3and4canvas.eps has been created

In [29]:
canvases[3].Draw()
canvases[3].SaveAs("plots/" + canvases[3].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/positiveZNegativeXShellLayers1and2canvas.eps has been created

In [30]:
canvases[4].Draw()
canvases[4].SaveAs("plots/" + canvases[4].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/negativeZPositiveXShellLayers3and4canvas.eps has been created

In [31]:
canvases[5].Draw()
canvases[5].SaveAs("plots/" + canvases[5].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/negativeZPositiveXShellLayers1and2canvas.eps has been created

In [32]:
canvases[6].Draw()
canvases[6].SaveAs("plots/" + canvases[6].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/negativeZNegativeXShellLayers3and4canvas.eps has been created

In [33]:
canvases[7].Draw()
canvases[7].SaveAs("plots/" + canvases[7].GetName() + ".eps")


Info in <TCanvas::Print>: eps file plots/negativeZNegativeXShellLayers1and2canvas.eps has been created

In [34]:
def uncapitalize(s): return s[:1].lower() + s[1:]
canvases = [None] * 12
graphs   = [None] * 12
mGraphs  = [None] * 12
for index in range(len(canvases)):
    side                   = index / 32
    halfShell              = (index - side * 32) / 16
    layerPair              = (index - side * 32 - halfShell * 16) / 8
    sec                    = index % 8
    sideAsString           = sideStrings[side - 1]
    secAsString            = str(sec + 1)
    halfShellAsString      = sideStrings[halfShell - 1]
    layerPairAsString      = layerPairStrings[layerPair - 1]
    layerPairAsShortString = layerPairStringsShort[layerPair - 1]
    graphs[index] = ROOT.TGraphAsymmErrors(mainDir.Get("LayerDetailed").Get("delayVsEfficiency" + sideAsString + "Z" + halfShellAsString + "XShellSector" + secAsString + "Layers" + layerPairAsShortString + "AsGraph"))
    mGraphs[index] = ROOT.TMultiGraph("m" + graphs[index].GetName(), graphs[index].GetTitle())
    mGraphs[index].Add(graphs[index])
    canvases[index] = drawWithSigmoidFitFunction(graphs[index].GetName() + "Canvas", mGraphs[index])
    print canvases[index]
    canvases[index].Draw()
    ps = graphs[index].GetListOfFunctions().FindObject("stats")
    if ps:
        ps.SetX1NDC(0.15)
        ps.SetX2NDC(0.55)
    label = ROOT.TLatex()
    label.SetTextAlign(22)
    label.DrawLatexNDC(0.50 + canvases[index].GetRightMargin() / 2 - canvases[index].GetLeftMargin() / 2, 0.5 + canvases[index].GetBottomMargin() / 2 - canvases[index].GetTopMargin() / 2, graphs[index].GetTitle()[23:26].capitalize() + ". Z, " + uncapitalize(graphs[index].GetTitle()[35:38]) + ". X, Sec. " + graphs[index].GetTitle()[-22:-21] + ", lay. " + graphs[index].GetTitle()[-12:-5]);
    canvases[index].Update()
    canvases[index].SaveAs("plots/" + graphs[index].GetName() + "WithFit.eps")


 FCN=100975 FROM MIGRAD    STATUS=FAILED        283 CALLS         284 TOTAL
                     EDM=1.26304e+06    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.95831e-01   1.39155e-03   4.84346e-06   4.01254e+06
   2  p1           1.63021e+02   4.27753e-04   7.80649e-09  -8.57370e+06
   3  p2           9.03226e-02   4.19319e-04   4.39305e-07  -7.85922e+06
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector1Layers3and4AsGraphCanvas") at 0x5f06740>
 FCN=4.88207e+06 FROM MIGRAD    STATUS=FAILED        183 CALLS         184 TOTAL
                     EDM=0.000111991    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.97951e-01   6.80669e-10   4.85377e-06   2.19872e+07
   2  p1           1.63047e+02   0.00000e+00   7.94344e-05  -1.02980e+08
   3  p2           9.00001e-02   4.18833e-26   4.55422e-04  -4.65225e+07
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector2Layers3and4AsGraphCanvas") at 0x5f05930>
 FCN=0.0137711 FROM HESSE     STATUS=NOT POSDEF     16 CALLS         569 TOTAL
                     EDM=0.000203929    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.29016e+00   1.01499e+01   1.45219e-05  -1.78156e-03
   2  p1           1.63234e+02   2.10943e+00   1.23837e-06   2.16854e-02
   3  p2           2.80026e-01   7.06285e-01   2.33524e-05   2.10205e-03
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector3Layers3and4AsGraphCanvas") at 0x5f24e00>
 FCN=458401 FROM MIGRAD    STATUS=FAILED        168 CALLS         169 TOTAL
                     EDM=1.1057e+14    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   1.00000e+00   0.00000e+00  -1.26996e+18
   2  p1           1.62213e+02   4.03710e+00  -0.00000e+00   4.69725e+19
   3  p2           9.20696e-02   1.00000e+00  -0.00000e+00   4.99189e+17
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector4Layers3and4AsGraphCanvas") at 0x5ed5570>
 FCN=5.85493e-41 FROM HESSE     STATUS=NOT POSDEF     32 CALLS         141 TOTAL
                     EDM=2.44246e-15    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0          -1.81303e-09   2.01773e+04   7.62721e-05   7.62255e-28
   2  p1           1.64557e+02   3.59216e+00   5.00000e-01  -4.25580e-39
   3  p2           8.81880e-02   3.69775e+09   4.32973e+07  -1.89013e-17
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector5Layers3and4AsGraphCanvas") at 0x5f39d00>
 FCN=1.31524e-07 FROM HESSE     STATUS=NOT POSDEF     36 CALLS         660 TOTAL
                     EDM=5.13389e-21    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.19368e-01   1.96228e-26   4.56100e-06   6.93737e-02
   2  p1           1.63324e+02   0.00000e+00   5.36655e-07  -7.09326e-01
   3  p2           9.59683e-02   7.28750e-10   9.33529e-08  -1.39046e-01
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector6Layers3and4AsGraphCanvas") at 0x5efd7c0>
 FCN=622.865 FROM MIGRAD    STATUS=FAILED        213 CALLS         214 TOTAL
                     EDM=950.223    STRATEGY= 1      ERR MATRIX APPROXIMATE
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           8.17561e-01   2.58384e-03   3.97640e-06   2.27703e+03
   2  p1           1.63000e+02   2.07780e-03   1.95920e-07   4.40007e+04
   3  p2           8.99397e-02   4.74571e-04   2.14433e-08   1.77462e+04
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector7Layers3and4AsGraphCanvas") at 0x5f090d0>
 FCN=46745.8 FROM MIGRAD    STATUS=FAILED        123 CALLS         124 TOTAL
                     EDM=1.55659e+24    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   1.62455e-20   0.00000e+00  -1.53598e+32
   2  p1           1.62275e+02   0.00000e+00   0.00000e+00  -3.13705e+03
   3  p2           9.00000e-02   8.77939e-18  -0.00000e+00  -1.05315e+04
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector8Layers3and4AsGraphCanvas") at 0x5ec22c0>
 FCN=714.307 FROM HESSE     STATUS=OK             16 CALLS         182 TOTAL
                     EDM=8.71741e-07    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.44558e-01   1.00264e-03   1.98219e-06  -2.22328e-01
   2  p1           1.62564e+02   8.58035e-04   6.18609e-07  -3.95721e+00
   3  p2           1.32206e-01   6.56470e-04   1.45868e-06   1.78446e+00
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector1Layers1and2AsGraphCanvas") at 0x5e93260>
 FCN=276015 FROM MIGRAD    STATUS=FAILED        124 CALLS         125 TOTAL
                     EDM=9.58296e+88    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00051e+00   1.00104e+00  -0.00000e+00   1.37535e+07
   2  p1           1.61987e+02   3.96721e+00  -0.00000e+00   0.00000e+00
   3  p2           3.44581e-04   1.00000e+00   0.00000e+00  -1.26030e+42
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector2Layers1and2AsGraphCanvas") at 0x5f0a510>
 FCN=1.76933e+07 FROM MIGRAD    STATUS=FAILED        256 CALLS         257 TOTAL
                     EDM=2.24266e+37    STRATEGY= 1  ERROR MATRIX UNCERTAINTY  13.3 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           9.82536e-01   1.00000e+00  -0.00000e+00   1.56395e+08
   2  p1           1.62720e+02   4.19238e+00  -0.00000e+00   6.42879e+23
   3  p2           9.17644e-02   1.00000e+00   0.00000e+00  -1.85609e+08
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector3Layers1and2AsGraphCanvas") at 0x5e6d390>
 FCN=0 FROM MIGRAD    STATUS=FAILED        160 CALLS         161 TOTAL
                     EDM=0.0168762    STRATEGY= 1      ERR MATRIX NOT POS-DEF
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.00000e+00   7.65496e-04  -0.00000e+00   3.27919e+02
   2  p1           1.63626e+02   6.33314e-07   0.00000e+00  -1.48495e+05
   3  p2           9.00000e-02   5.96263e-04   0.00000e+00  -1.14341e+01
<ROOT.TCanvas object ("delayVsEfficiencyPositiveZPositiveXShellSector4Layers1and2AsGraphCanvas") at 0x5e4c880>
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector1Layers3and4AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector2Layers3and4AsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector3Layers3and4AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector4Layers3and4AsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector5Layers3and4AsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector6Layers3and4AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector7Layers3and4AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector8Layers3and4AsGraphWithFit.eps has been created
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector1Layers1and2AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector2Layers1and2AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector3Layers1and2AsGraphWithFit.eps has been created
Warning in <Fit>: Abnormal termination of minimization.
Info in <TCanvas::Print>: eps file plots/delayVsEfficiencyPositiveZPositiveXShellSector4Layers1and2AsGraphWithFit.eps has been created

In [ ]: